<template>
  <div>
    <el-container>
      <!-- <el-header style="padding:0;height: 56px;">
        <headbox ref="mychild"></headbox>
      </el-header>-->
      <el-container>
        <!-- <el-aside  style="width:200px;background-color:#393D49;">
          <left></left>
        </el-aside>-->
        <el-container>
          <el-main style="padding:0;">
             <p class="titlelist6_10">
                我的信息
                <span style="color: #999;">&nbsp;&nbsp;/&nbsp;&nbsp;</span>结算信息
              </p>
            <!-- 放置内容区 -->
            <div class="contbox6_10">
              <!-- 机构列表 -->
             
              <div style="background:#F7F7F7;padding:20px 0;height:60px;margin-top:36px">
                <el-row style="">
                  <el-col :span="6">
                    <p class="accountText">账户余额（元）: 0</p>
                    <!-- <p class="accountText">{{0}}</p> -->
                  </el-col>
                <!-- <el-row style="margin-top:30px;"> -->
                  <el-col :span="6">
                    <p class="accountText">当前账户收益总额（元）: 0</p>
                    <!-- <p class="accountText">{{0}}</p> -->
                  </el-col>
                  <el-col :span="6">
                    <p class="accountText">昨日收益总额（元）: 0</p>
                    <!-- <p class="accountText">{{0}}</p> -->
                  </el-col>
                  <el-col :span="6">
                    <p class="accountText">本月收益总额（元）: 0</p>
                    <!-- <p class="accountText">{{0}}</p> -->
                  </el-col>
                  <el-col :span="6">
                    <p class="accountText">累计收益总额（元）：0</p>
                    <!-- <p class="accountText">{{0}}</p> -->
                  </el-col>
                </el-row>
              </div>

              <div>
                <el-form
                  :model="ruleForm"
                  v-loading="listLoading"
                  :hide-required-asterisk="true"
                  ref="ruleForm"
                  label-width="130px"
                  class="demo-ruleForm"
                >
                  <p class="sizes">如需修改资料，请联系上级平台方</p>
                  <div class="left">
                    <el-form-item label="请完善本部信息"></el-form-item>
                    <el-col>
                    <el-form-item label="账户类型：" style="float: left;margin-right: 40px;">
                      <el-select v-model="ruleForm.accountType" placeholder="请选择">
                        <el-option label="对公" value="0"></el-option>
                        <el-option label="对私" value="1"></el-option>
                      </el-select>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="结算账户名：" prop="treasureAccount">
                      <el-input class="ipt" placeholder="请输入结算账户名" v-model="ruleForm.accountName"></el-input>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="结算账号：" prop="ContactName">
                      <el-input class="ipt" @input="value=>{ruleForm.accountNo=value.replace(/[^\d]+/g,'')}" placeholder="请输入结算账号" v-model="ruleForm.accountNo"></el-input>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="开户银行：" prop="email">
                      <el-input class="ipt" placeholder="请输入开户银行" v-model="ruleForm.bankName"></el-input>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="开户支行：" prop="tel">
                      <el-input class="ipt" placeholder="请输入开户支行" v-model="ruleForm.openBank"></el-input>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="开户身份证号：" prop="tel">
                      <el-input class="ipt" onkeyup="value=value.replace(/[^\d]+/g,'')" placeholder="请输入开户身份证号" v-model="ruleForm.certNbr"></el-input>
                    </el-form-item>
                    </el-col>
                    <el-col>
                    <el-form-item label="银行预留手机号：" prop="tel">
                      <el-input class="ipt" onkeyup="value=value.replace(/[^\d]+/g,'')" placeholder="请输入银行预留手机号" v-model="ruleForm.reservedMobile"></el-input>
                    </el-form-item>
                    </el-col>
                    <!-- <el-col> -->
                    <!-- <el-form-item label="电子账户卡号：" prop="tel">
                      <el-input class="ipt" onkeyup="value=value.replace(/[^\d]+/g,'')" placeholder="请输入电子账户卡号" v-model="ruleForm.accountNo"></el-input>
                    </el-form-item> -->
                    <!-- </el-col> -->
                  </div>
                </el-form>
                <div style="clear:both"></div>
                <el-button class="elBtn" type="primary" @click="submitForm('ruleForm')">完成</el-button>
              </div>
            </div>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>

import https from "../../plugins/https";
export default {
  name: "AdminSettlement",
  data() {
    return {
      ruleForm: {
        aliNo: "",
        aliName: "",
        aliEmail: "",
        aliPhone: "",
        accountType: "", //账户类型
        accountName: "",
        accountNo: "",
        bankName: "",
        openBank: "",
        certNbr: "",
        reservedMobile: "",
      },
      listLoading: "",
    };
  },
  components: {
  },
  mounted() {
    this.getUpdateOfficeInfo();
  },
  methods: {
    // 页面渲染
    getUpdateOfficeInfo() {
      this.listLoading = true;
      https
        .getUpdateOfficeInfo({ officeUid: localStorage.getItem("uid") })
        .then((res) => {
          if (res.data.code !== "0000") {
            layer.open({
            content: res.data.msg,
            skin: "msg",
            time:  2 //1秒后自动关闭
          });
            this.listLoading = false;
            return;
          }
          this.ruleForm = res.data.data;
          this.listLoading = false;
        });
    },
    // 点击完成
    submitForm(formName) {
      if (!/^1[3456789]\d{9}$/.test(this.ruleForm.reservedMobile) && this.ruleForm.reservedMobile!="")
        return layer.open({
          content:"银行预留手机号码有误，请重填",
          skin: "msg",
          time:  2 //1秒后自动关闭
        });
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // alert('submit!');
          this.listLoading = true;
          https.saveAdminAccount(this.ruleForm).then((res) => {
            if (res.data.code !== "0000") {
              layer.open({
            content: res.data.msg,
            skin: "msg",
            time:  2 //1秒后自动关闭
          });
              this.listLoading = false;
              return;
            }
            this.getUpdateOfficeInfo();
            layer.open({
            content: res.data.msg,
            skin: "msg",
            time:  2 //1秒后自动关闭
          });
            this.listLoading = false;
          });
        } else {
          return false;
        }
      });
    },
  },
};
</script>

<style scoped>
.elBtn {
  margin-top: 20px;
  float: left;
  margin-left: 100px;
}
.left {
  width: 35%;
  float: left;
}
.right {
  width: 40%;
  border-left: 1px solid #999;
  float: left;
  margin-left: 60px;
  padding-left: 60px;
}
.sizes {
  font-size: 15px;
  margin-top: 60px;
  margin-bottom: 20px;
  color: #999;
}
/* 单独样式 */
.contbox6_10 {
  width: 96%;
  padding: 20px;
}
.accountText {
  font-size: 15px;
  font-family: MicrosoftYaHei;
  line-height: 20px;
  color: #393d49;
  opacity: 1;
  padding-left: 20px;
}
.el-col-6{
  width: 300px;
}
</style>

